|
- import fetch from 'node-fetch'
-
- interface Film {
- title: string,
- seed: number,
- size: string,
- age: string,
- magnet: string,
- provider: string,
- }
-
- let films: Film[] = []
-
-
-
-
- export default eventHandler(async (req) => {
- const terms = req.context.params?.terms || ''
- const url = `https://api.themoviedb.org/3/search/movie?query=${terms}&include_adult=false&language=en-US&page=1`
-
- const response = await fetch(url, {
- method: 'get',
- headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI2MmVmZmYzYWU2YWYyNWQ0NTY4OGY3OTkxYjgyNmNhOCIsIm5iZiI6MTcyODA1NTIwMy4wNzcyNywic3ViIjoiNjcwMDA2ZjQ5ZWJlYTE5MDA2ZjgxZmJhIiwic2NvcGVzIjpbImFwaV9yZWFkIl0sInZlcnNpb24iOjF9.XuH-_0UggmULCgQQajKc-QsmlRYW2rqSenyhguE6wRU' }
- })
- const data = await response.json()
- return data.results
- })
|